//
//  MDAnimationController.swift
//  麦兜直播
//
//  Created by Apple on 16/10/24.
//  Copyright © 2016年 yeqingyu. All rights reserved.
//

import UIKit

class MDAnimationController: UIViewController {
    var contentView:UIView?
    
    fileprivate lazy var imageView:UIImageView = {[unowned self] in
        let imageView = UIImageView(image: UIImage(named: "img_loading_1"))
        imageView.center = self.view.center
        let images:[UIImage] = [UIImage(named: "img_loading_1")!,UIImage(named: "img_loading_2")!]
        imageView.animationImages = images
        imageView.animationDuration = 0.5
        imageView.animationRepeatCount = LONG_MAX
        imageView.autoresizingMask = [.flexibleBottomMargin,.flexibleTopMargin]
        return imageView
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

     
    }
    
    func setUpUI(){
        view.addSubview(imageView)
        contentView?.isHidden = true
        imageView.isHidden = false
        imageView.startAnimating()
    }
    
    //结束动画
    func stopAnimation() {
        imageView.stopAnimating()
        contentView?.isHidden = false
        imageView.isHidden = true
    }
}
